<template>
  <div class="todo">
    <TodoHeader></TodoHeader>
    <p>testFullName: {{ testFullName }}, testCountPlus:{{ testCountPlus }} </p>
    <p>testCount:{{ testCount }} </p>
    <p>getSuperAdminFullName: {{ getSuperAdminFullName }}</p>
    <p>superAdminUserName: {{ superAdminUserName }}</p>
    <p>superAdminState: {{ superAdminState }}</p>
    <p>superAdminNumber: {{ superAdminNumber }}</p>
    <router-view></router-view>
    <TodoFooter></TodoFooter>
  </div>
</template>
<script>
import TodoHeader from "@/todo/todoheader.vue";
import TodoFooter from "@/todo/todofooter.vue";
//vuex
import { mapState, mapGetters, mapMutations, mapActions } from "vuex";
export default {
  components: {
    TodoHeader,
    TodoFooter
  },
  computed: {
    ...mapGetters({
      testFullName: "test/fullName",
      testCountPlus: "test/countPlus1",
      getSuperAdminFullName: "getSuperAdminFullName"
    }),
    ...mapState({
      testCount: state => state.test.count,
      superAdminUserName: "superAdminUserName",
      superAdminState: "superAdminState",
      superAdminNumber: "superAdminNumber"
    })
  },
  methods: {
    ...mapMutations({
      testUpdateCount: "test/updateCount",
      addSuperAdminNumber: "addSuperAdminNumber",
      changeSuperAdminStateTrue: "changeSuperAdminStateTrue",
      changeSuperAdminStateFalse: "changeSuperAdminStateFalse",
      resetSuperAdminNumber: "resetSuperAdminNumber"
    }),
    ...mapActions({
      testUpdateCountAsync: "test/updateCountAsync",
      delayResetSuperAdminNumber: "delayResetSuperAdminNumber",
      addSuperAdminNumberAlways: "addSuperAdminNumberAlways"
    })
  },
  mounted() {
    // this.testUpdateCount();
    // this.testUpdateCountAsync({count:10, time: 3000});
    this.addSuperAdminNumber();
    // this.delayResetSuperAdminNumber();
    // this.addSuperAdminNumberAlways();
    // this.$store.subscribe((mutation, state) => {
    //   console.log(mutation.type, mutation.payload);
    //   console.log(state);
    // })
  }
};
</script>

<style lang="scss">
</style>
